package com.mengtian_tech.tju.dataquery.api.service;

import java.util.Date;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mengtian_tech.tju.dataquery.api.model.dataAIMysql.LoginSession;
import com.mengtian_tech.tju.dataquery.api.repo.dataAI.LoginSessionRepo;

@Service
public class LoginSessionService {
	@Autowired
	LoginSessionRepo loginSessionRepo;
	
	public LoginSession createSession(String userId,String ip,String remark, int clientType) {
		LoginSession session = new LoginSession();
		session.setCreateDate(new Date());
		session.setId(UUID.randomUUID().toString());
		session.setUserId(userId);
		session.setIp(ip);
		session.setClientType(clientType);
		session.setRemark(remark);
		loginSessionRepo.save(session);
		
		return session;
	}
}
